<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html>
<html>
<head>
    <title></title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/theme/jquery.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/layerui/layer.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/layerui/layer.ext.js"></script>
	<link rel="stylesheet" href="${pageContext.request.contextPath}/css/skin/css/mobilecss/charge.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/skin/css/mobilecss/main.css">
    <style type="text/css">
        body {
            padding-bottom: 40px;
            
        }
        .sidebar-nav {
            padding: 9px 0;
        }

        @media (max-width: 980px) {
            /* Enable use of floated navbar text */
            .navbar-text.pull-right {
                float: none;
                padding-left: 5px;
                padding-right: 5px;
            }
        }


    </style>
</head>
<body>
<form action="" method="post" class="definewidth m20">
<input type="hidden" name="id" value="{$user.id}" />
<div class="container">
        <p style="font-size: 0.9rem" id="addTitle">修改密码</p>
        <div style="border: 1px solid #636363">
            <span style="border:none;padding: 0.5rem;">旧密码</span>
            <input type="password" id="oldPassword" name="oldPassword" placeholder="请输入旧密码" style="border: none;width: 60%;background-color: #FFFFFF">
        </div>
        <div style="border: 1px solid #636363">
            <span style="border:none;padding: 0.5rem;">新密码</span>
            <input type="password" id="newPassword" name="newPassword" placeholder="请输入新密码"  style="border: none;width: 60%">
        </div>
        <div style="border: 1px solid #636363">
            <span style="border:none;padding: 0.5rem;">新密码</span>
            <input type="password" id="newPassword2" name="newPassword2" placeholder="请再次输入新密码"  style="border: none;width: 60%">
        </div>
        <div style="margin-top: 3rem">
            <button type="button" style="width: 100%" id="savePwd" >确认修改</button>
        </div>
    </div>
</form>
</body>
<script type="text/javascript">
    $(function () {       
		$('#savePwd').click(function(){
			if($("#oldPassword").val()==""){
				layer.alert("旧密码不能为空");
				return;
			}
			if($("#newPassword").val()==""){
				layer.alert("新密码不能为空");
				return;
			}
			if($("#newPassword").val()!=$("#newPassword2").val()){
				layer.alert("两次密码不一致， 请重新输入 ");
				return;
			}
			$.post("${pageContext.request.contextPath}/admin/updatepwd_save.html",
		       {"oldPassword":$("#oldPassword").val(),"newPassword":$("#newPassword").val(),"newPassword2":$("#newPassword2").val()},
		       function(data){
	            	var json = eval("("+data+")");
					if(json.statusCode =='200'){
						layer.alert(" 密码已修改，  请重新登录  ~");
						setTimeout("closewind()",2000);
					}else{
						layer.alert(json.message);
					}
		      });
		 });
		
    });
    function closewind(){
    	top.window.location.href="${pageContext.request.contextPath}/admin/logout.html";
    }
    
    
</script>
</html>